package com.corpgovernment.organization.enumm.budget;

import java.util.LinkedHashMap;
import java.util.Map;

public enum BudgetTypeEnum {

    FLIGHT("flight", "国内机票"),
    HOTEL("hotel", "国内酒店"),
    TRAIN("train", "火车票"),
    CAR("car", "用车"),
	INTLFLIGHT("intlflight", "国际机票"),
	INTLHOTEL("intlhotel", "海外酒店"),
	OTHER("other", "其他");

    private String type;
    private String name;

    BudgetTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    private static Map<String, BudgetTypeEnum> typeMap = new LinkedHashMap<>();

    static {
        for (BudgetTypeEnum budgetTypeEnum : BudgetTypeEnum.values()) {
            typeMap.put(budgetTypeEnum.getType(), budgetTypeEnum);
        }
    }

    public static BudgetTypeEnum getEnumByType(String type) {
        return typeMap.get(type);
    }
}